﻿using System;

using Castle.Windsor;
using Castle.Facilities.NHibernateIntegration.Internal;
using Castle.Core.Configuration;
using System.IO;

namespace ScriptManager.Data.Utilities
{
    public class IoC
    {
        private static IWindsorContainer _container;

        public IoC()
        {
            //Not calling this constructor for some reason when calling the static method below.
            ConfigPath = "castle.config";
            
        }

        public static string ConfigPath { get; set; }

        public static IWindsorContainer Container
        {
            get
            {
                if (_container == null)
                {
                    ConfigPath = "D:\\Projects\\SVN Repositories\\ScriptManager\\ScriptManager.Console\\castle.config";
                    _container = new WindsorContainer(ConfigPath);
                }

                return _container;
            }
        }
    }
}
